package com.example.user.controller;

import com.example.user.service.AuthUserService;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.model.user.pojos.ApUserRealname;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 身份验证用户控制器
 *
 */
@RestController
@RequestMapping("/user/v1")
public class AuthUserController {
    @Autowired
    AuthUserService authUserService;
    
    
    /**
     * 得到所有用户
     *
     * @param pageNum  当前页数
     * @param pageSize 每页数量
     * @return {@code ResponseResult}
     */
    @GetMapping("/get_all_user")
    public ResponseResult getAllUser(Integer pageNum, Integer pageSize){
        List<ApUserRealname> allUser = authUserService.getAllUser(pageNum,pageSize);
        return ResponseResult.okResult(allUser);
    }
    
    
    /**
     * 审核
     *
     * @param authDto auth dto
     * @return {@code ResponseResult}
     */
    @PostMapping("auditing")
    public ResponseResult auditing(@RequestBody AuthDto authDto){
        return authUserService.auditing(authDto);
    }
}
